<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: wheels::mqttClient类 参考</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../df/d8d/namespacewheels.html">wheels</a></li><li class="navelem"><a class="el" href="../../dc/d63/classwheels_1_1mqtt_client.html">mqttClient</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">类</a> &#124;
<a href="#pub-types">Public 类型</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="../../d6/d3c/classwheels_1_1mqtt_client-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">wheels::mqttClient类 参考</div></div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="../../d5/d27/mqtt_8hpp_source.html">mqtt.hpp</a>&gt;</code></p>
<div class="dynheader">
wheels::mqttClient 的协作图:</div>
<div class="dyncontent">
<div class="center"><img src="../../db/d01/classwheels_1_1mqtt_client__coll__graph.png" border="0" usemap="#awheels_1_1mqtt_client_coll__map" alt="Collaboration graph"/></div>
<map name="awheels_1_1mqtt_client_coll__map" id="awheels_1_1mqtt_client_coll__map">
<area shape="rect" title=" " alt="" coords="5,5,215,811"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
类</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">从path.mqtt继承消息结构，提供消息构造接口  <a href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html#details">更多...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-types" name="pub-types"></a>
Public 类型</h2></td></tr>
<tr class="memitem:a9ef036b2ecddf62dde5597f6e9936616" id="r_a9ef036b2ecddf62dde5597f6e9936616"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a> { <br />
&#160;&#160;<a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a33c6b9b9cdffb437ff82f7b0c92796a2">ERR_ALLOC_MEM</a> = -1000
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a8eff9f87415d22cf12e9ee6136bbae55">ERR_USR_PSWD</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616ae85f474018fc5e71caf05c110a08c0b0">ERR_CONN</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616ae19fede179cf0ab078776cd54de79e3e">ERR_CREATE_CTX</a>
, <br />
&#160;&#160;<a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a85c545311ea0b331c9156178e2582321">ERR_PUB</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616af41222b61563e3daed16805a628f4803">ERR_SUB</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a30409d6c1d58cc54ade3ecc578596933">ERR_INSERT_CB</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a1d74073b96c95c75a22103ebb601f8bc">ERR_UNSUB</a>
, <br />
&#160;&#160;<a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616ac28e9e41af6580a0fbb4c4befce3cddd">ERR_QOS_RANGE</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a6a8715111fc7a075e2289346cf61548e">ERR_DATA_NULL</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616acfcae9b57ddf17a5e43b14c5d558bef3">ERR_URL_EMPTY</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a5806ee274c8dfa7902e5f995ac627401">ERR_CID_EMPTY</a>
, <br />
&#160;&#160;<a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a2b1c9d335ac095108055871883cf8ad0">ERR_ACCOUNT_EMPTY</a>
, <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616a26fb6f4f8581ee63fcb770371a50a5dc">OK</a> = 0
<br />
 }</td></tr>
<tr class="separator:a9ef036b2ecddf62dde5597f6e9936616"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b272a0a34fd930f7340a59f5e0edbf5" id="r_a4b272a0a34fd930f7340a59f5e0edbf5"><td class="memItemLeft" align="right" valign="top">typedef std::map&lt; std::string, std::function&lt; void(const std::string &amp;, const <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a> &amp;) &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4b272a0a34fd930f7340a59f5e0edbf5">msgCallback</a></td></tr>
<tr class="separator:a4b272a0a34fd930f7340a59f5e0edbf5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:aa5e61c99c5000159df5ae7a8bef121ff" id="r_aa5e61c99c5000159df5ae7a8bef121ff"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa5e61c99c5000159df5ae7a8bef121ff">mqttClient</a> (const std::string &amp;svr, const std::string &amp;cid)</td></tr>
<tr class="memdesc:aa5e61c99c5000159df5ae7a8bef121ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造MQTT客户端。在默认情况下如果不指定MQTT协议的版本，以3.1.1版本尝试连接；如果练级失败会尝试以3.1连接，再次失败会以5.0版本尝试  <br /></td></tr>
<tr class="separator:aa5e61c99c5000159df5ae7a8bef121ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a70147cdf4f553bb2129e368d16d6cc27" id="r_a70147cdf4f553bb2129e368d16d6cc27"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a70147cdf4f553bb2129e368d16d6cc27">mqttClient</a> (const std::string &amp;svr, const std::string &amp;cid, const std::string &amp;usr, const std::string &amp;pswd)</td></tr>
<tr class="separator:a70147cdf4f553bb2129e368d16d6cc27"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae7b92bc1964d9d3bf1d64fb2f10d23fc" id="r_ae7b92bc1964d9d3bf1d64fb2f10d23fc"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae7b92bc1964d9d3bf1d64fb2f10d23fc">~mqttClient</a> ()</td></tr>
<tr class="separator:ae7b92bc1964d9d3bf1d64fb2f10d23fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6e079b0c420f464d3b2ba100741f1bc" id="r_aa6e079b0c420f464d3b2ba100741f1bc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa6e079b0c420f464d3b2ba100741f1bc">version</a> (int v)</td></tr>
<tr class="separator:aa6e079b0c420f464d3b2ba100741f1bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4329b65aa8c1abb55bcb3db9681fdaa3" id="r_a4329b65aa8c1abb55bcb3db9681fdaa3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4329b65aa8c1abb55bcb3db9681fdaa3">connect</a> ()</td></tr>
<tr class="separator:a4329b65aa8c1abb55bcb3db9681fdaa3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a22ff47cb8d97053a4cfe5ff42d18ef8a" id="r_a22ff47cb8d97053a4cfe5ff42d18ef8a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a22ff47cb8d97053a4cfe5ff42d18ef8a">connect</a> (const std::string &amp;cid, const std::string &amp;user, const std::string &amp;pswd)</td></tr>
<tr class="separator:a22ff47cb8d97053a4cfe5ff42d18ef8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7bf7e3ef62cc9846865268cf499148ee" id="r_a7bf7e3ef62cc9846865268cf499148ee"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a7bf7e3ef62cc9846865268cf499148ee">setDisconnect</a> (std::function&lt; void() &gt; fun)</td></tr>
<tr class="separator:a7bf7e3ef62cc9846865268cf499148ee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad7447ba17575882ac4c7c286d82c2b27" id="r_ad7447ba17575882ac4c7c286d82c2b27"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad7447ba17575882ac4c7c286d82c2b27">onDisconnect</a> (const std::string &amp;cause)</td></tr>
<tr class="memdesc:ad7447ba17575882ac4c7c286d82c2b27"><td class="mdescLeft">&#160;</td><td class="mdescRight">onDisconnect  <br /></td></tr>
<tr class="separator:ad7447ba17575882ac4c7c286d82c2b27"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac71f4aefef7cea607fc58569bfa23ce4" id="r_ac71f4aefef7cea607fc58569bfa23ce4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac71f4aefef7cea607fc58569bfa23ce4">pub</a> (const std::string &amp;topic, const uint8_t *data, size_t len)</td></tr>
<tr class="memdesc:ac71f4aefef7cea607fc58569bfa23ce4"><td class="mdescLeft">&#160;</td><td class="mdescRight">采用默认的消息体发布消息，在默认情况下Qos = 1, retain = true， dup=0  <br /></td></tr>
<tr class="separator:ac71f4aefef7cea607fc58569bfa23ce4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6be7209c55c982b1a61ea83e58153bf8" id="r_a6be7209c55c982b1a61ea83e58153bf8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a6be7209c55c982b1a61ea83e58153bf8">pub</a> (const std::string &amp;topic, <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a> &amp;msg)</td></tr>
<tr class="memdesc:a6be7209c55c982b1a61ea83e58153bf8"><td class="mdescLeft">&#160;</td><td class="mdescRight">按照自定义消息的方法发布消息，可以通过构造msg内容来实现  <br /></td></tr>
<tr class="separator:a6be7209c55c982b1a61ea83e58153bf8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a100bbcd47136dca546d1b36ba4086845" id="r_a100bbcd47136dca546d1b36ba4086845"><td class="memItemLeft" align="right" valign="top"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a100bbcd47136dca546d1b36ba4086845">sub</a> (const std::string &amp;topic, int qos, std::function&lt; void(const std::string &amp;tp, const <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a> &amp;) &gt; cb)</td></tr>
<tr class="memdesc:a100bbcd47136dca546d1b36ba4086845"><td class="mdescLeft">&#160;</td><td class="mdescRight">订阅主题，并登记相关主题的回调函数  <br /></td></tr>
<tr class="separator:a100bbcd47136dca546d1b36ba4086845"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75add329cda55d67c6e106e814617afd" id="r_a75add329cda55d67c6e106e814617afd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a75add329cda55d67c6e106e814617afd">unSub</a> (const std::string &amp;topic)</td></tr>
<tr class="separator:a75add329cda55d67c6e106e814617afd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8891a42152cd57b070ff9605d836013" id="r_ad8891a42152cd57b070ff9605d836013"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad8891a42152cd57b070ff9605d836013">onRecv</a> (const std::string &amp;tp, const <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a> &amp;msg)</td></tr>
<tr class="memdesc:ad8891a42152cd57b070ff9605d836013"><td class="mdescLeft">&#160;</td><td class="mdescRight">处理接收到消息后的操作  <br /></td></tr>
<tr class="separator:ad8891a42152cd57b070ff9605d836013"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a087c54091586ca6631b483624ae01cbe" id="r_a087c54091586ca6631b483624ae01cbe"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a087c54091586ca6631b483624ae01cbe">isConnected</a> ()</td></tr>
<tr class="memdesc:a087c54091586ca6631b483624ae01cbe"><td class="mdescLeft">&#160;</td><td class="mdescRight">是否已经成功建立连接  <br /></td></tr>
<tr class="separator:a087c54091586ca6631b483624ae01cbe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a677c0a83def22ef765ebe23803423d38" id="r_a677c0a83def22ef765ebe23803423d38"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a677c0a83def22ef765ebe23803423d38">reconnect</a> (const std::string &amp;cid, const std::string &amp;pswd)</td></tr>
<tr class="memdesc:a677c0a83def22ef765ebe23803423d38"><td class="mdescLeft">&#160;</td><td class="mdescRight">重新连接  <br /></td></tr>
<tr class="separator:a677c0a83def22ef765ebe23803423d38"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:af3facee7aa2c691086a033399213b1bf" id="r_af3facee7aa2c691086a033399213b1bf"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af3facee7aa2c691086a033399213b1bf">errMsg</a> (<a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a> e)</td></tr>
<tr class="separator:af3facee7aa2c691086a033399213b1bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock">
<p class="definition">在文件 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html">mqtt.hpp</a> 第 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html#l00016">16</a> 行定义.</p>
</div><h2 class="groupheader">成员类型定义说明</h2>
<a id="a4b272a0a34fd930f7340a59f5e0edbf5" name="a4b272a0a34fd930f7340a59f5e0edbf5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4b272a0a34fd930f7340a59f5e0edbf5">&#9670;&#160;</a></span>msgCallback</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef std::map&lt; std::string , std::function&lt; void (const std::string&amp; , const <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a>&amp; ) &gt; &gt; <a class="el" href="#a4b272a0a34fd930f7340a59f5e0edbf5">wheels::mqttClient::msgCallback</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>定义消息回调存储结构。 </p><dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">std::string</td><td>消息主题 </td></tr>
    <tr><td class="paramname">std::function&lt;</td><td>void (const <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html" title="从path.mqtt继承消息结构，提供消息构造接口">stMsg</a>&amp; ) &gt; 消息回调函数 </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html">mqtt.hpp</a> 第 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html#l00071">71</a> 行定义.</p>

</div>
</div>
<h2 class="groupheader">成员枚举类型说明</h2>
<a id="a9ef036b2ecddf62dde5597f6e9936616" name="a9ef036b2ecddf62dde5597f6e9936616"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9ef036b2ecddf62dde5597f6e9936616">&#9670;&#160;</a></span>emErrCode</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">wheels::mqttClient::emErrCode</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">枚举值</th></tr><tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a33c6b9b9cdffb437ff82f7b0c92796a2" name="a9ef036b2ecddf62dde5597f6e9936616a33c6b9b9cdffb437ff82f7b0c92796a2"></a>ERR_ALLOC_MEM&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a8eff9f87415d22cf12e9ee6136bbae55" name="a9ef036b2ecddf62dde5597f6e9936616a8eff9f87415d22cf12e9ee6136bbae55"></a>ERR_USR_PSWD&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616ae85f474018fc5e71caf05c110a08c0b0" name="a9ef036b2ecddf62dde5597f6e9936616ae85f474018fc5e71caf05c110a08c0b0"></a>ERR_CONN&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616ae19fede179cf0ab078776cd54de79e3e" name="a9ef036b2ecddf62dde5597f6e9936616ae19fede179cf0ab078776cd54de79e3e"></a>ERR_CREATE_CTX&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a85c545311ea0b331c9156178e2582321" name="a9ef036b2ecddf62dde5597f6e9936616a85c545311ea0b331c9156178e2582321"></a>ERR_PUB&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616af41222b61563e3daed16805a628f4803" name="a9ef036b2ecddf62dde5597f6e9936616af41222b61563e3daed16805a628f4803"></a>ERR_SUB&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a30409d6c1d58cc54ade3ecc578596933" name="a9ef036b2ecddf62dde5597f6e9936616a30409d6c1d58cc54ade3ecc578596933"></a>ERR_INSERT_CB&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a1d74073b96c95c75a22103ebb601f8bc" name="a9ef036b2ecddf62dde5597f6e9936616a1d74073b96c95c75a22103ebb601f8bc"></a>ERR_UNSUB&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616ac28e9e41af6580a0fbb4c4befce3cddd" name="a9ef036b2ecddf62dde5597f6e9936616ac28e9e41af6580a0fbb4c4befce3cddd"></a>ERR_QOS_RANGE&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a6a8715111fc7a075e2289346cf61548e" name="a9ef036b2ecddf62dde5597f6e9936616a6a8715111fc7a075e2289346cf61548e"></a>ERR_DATA_NULL&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616acfcae9b57ddf17a5e43b14c5d558bef3" name="a9ef036b2ecddf62dde5597f6e9936616acfcae9b57ddf17a5e43b14c5d558bef3"></a>ERR_URL_EMPTY&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a5806ee274c8dfa7902e5f995ac627401" name="a9ef036b2ecddf62dde5597f6e9936616a5806ee274c8dfa7902e5f995ac627401"></a>ERR_CID_EMPTY&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a2b1c9d335ac095108055871883cf8ad0" name="a9ef036b2ecddf62dde5597f6e9936616a2b1c9d335ac095108055871883cf8ad0"></a>ERR_ACCOUNT_EMPTY&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="a9ef036b2ecddf62dde5597f6e9936616a26fb6f4f8581ee63fcb770371a50a5dc" name="a9ef036b2ecddf62dde5597f6e9936616a26fb6f4f8581ee63fcb770371a50a5dc"></a>OK&#160;</td><td class="fielddoc"></td></tr>
</table>

<p class="definition">在文件 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html">mqtt.hpp</a> 第 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html#l00019">19</a> 行定义.</p>

</div>
</div>
<h2 class="groupheader">构造及析构函数说明</h2>
<a id="aa5e61c99c5000159df5ae7a8bef121ff" name="aa5e61c99c5000159df5ae7a8bef121ff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5e61c99c5000159df5ae7a8bef121ff">&#9670;&#160;</a></span>mqttClient() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">mqttClient::mqttClient </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>svr</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>cid</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>构造MQTT客户端。在默认情况下如果不指定MQTT协议的版本，以3.1.1版本尝试连接；如果练级失败会尝试以3.1连接，再次失败会以5.0版本尝试 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">svr[</td><td>I ], </td></tr>
    <tr><td class="paramname">cid[</td><td>I ], 客户端ID </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00186">186</a> 行定义.</p>
<div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="../../dc/d63/classwheels_1_1mqtt_client_aa5e61c99c5000159df5ae7a8bef121ff_cgraph.png" border="0" usemap="#adc/d63/classwheels_1_1mqtt_client_aa5e61c99c5000159df5ae7a8bef121ff_cgraph" alt=""/></div>
<map name="adc/d63/classwheels_1_1mqtt_client_aa5e61c99c5000159df5ae7a8bef121ff_cgraph" id="adc/d63/classwheels_1_1mqtt_client_aa5e61c99c5000159df5ae7a8bef121ff_cgraph">
<area shape="rect" title="构造MQTT客户端。在默认情况下如果不指定MQTT协议的版本，以3.1.1版本尝试连接；如果练级失败会尝试以3.1连接，再次失败会以5.0版本尝试" alt="" coords="5,93,136,136"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a2a87ef47168dc639b307a285b8cb4462" title=" " alt="" coords="186,51,256,77"/>
<area shape="poly" title=" " alt="" coords="135,90,170,78,172,83,137,95"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a4a79780b9057489f0740020d6bae250f" title=" " alt="" coords="185,101,258,128"/>
<area shape="poly" title=" " alt="" coords="136,112,169,112,169,117,136,117"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a1f0795cbda29e32b3d6f379c226726f3" title=" " alt="" coords="184,152,259,179"/>
<area shape="poly" title=" " alt="" coords="137,134,170,145,168,150,135,139"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#ad7447ba17575882ac4c7c286d82c2b27" title="onDisconnect" alt="" coords="338,5,469,48"/>
<area shape="poly" title=" " alt="" coords="256,54,323,40,324,46,257,60"/>
<area shape="rect" href="../../d3/d47/classwheels_1_1debug.html#a5fa52d8a6d24d2f6686055e7cefa04b6" title=" " alt="" coords="307,72,500,99"/>
<area shape="poly" title=" " alt="" coords="257,65,292,70,291,75,257,71"/>
<area shape="rect" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html#a76cd2f25cc8ce95667c217e3e9fad0ff" title="从paho.mqtt构造对象" alt="" coords="338,133,469,176"/>
<area shape="poly" title=" " alt="" coords="259,160,323,157,323,162,260,166"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#ad8891a42152cd57b070ff9605d836013" title="处理接收到消息后的操作" alt="" coords="338,200,469,243"/>
<area shape="poly" title=" " alt="" coords="260,174,324,194,323,199,259,179"/>
</map>
</div>

</div>
</div>
<a id="a70147cdf4f553bb2129e368d16d6cc27" name="a70147cdf4f553bb2129e368d16d6cc27"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a70147cdf4f553bb2129e368d16d6cc27">&#9670;&#160;</a></span>mqttClient() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">mqttClient::mqttClient </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>svr</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>cid</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>usr</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>pswd</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>在MQTT 3.1.1 会支持使用用户名和密码登录 </p><dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">svr</td><td>[ I ], 服务器信息，比如tcp://xxx.xxx.xxx:1883 </td></tr>
    <tr><td class="paramname">usr</td><td>[ I ], 用户名 </td></tr>
    <tr><td class="paramname">pswd</td><td>[ I ], 登录密码 </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00204">204</a> 行定义.</p>
<div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="../../dc/d63/classwheels_1_1mqtt_client_a70147cdf4f553bb2129e368d16d6cc27_cgraph.png" border="0" usemap="#adc/d63/classwheels_1_1mqtt_client_a70147cdf4f553bb2129e368d16d6cc27_cgraph" alt=""/></div>
<map name="adc/d63/classwheels_1_1mqtt_client_a70147cdf4f553bb2129e368d16d6cc27_cgraph" id="adc/d63/classwheels_1_1mqtt_client_a70147cdf4f553bb2129e368d16d6cc27_cgraph">
<area shape="rect" title=" " alt="" coords="5,93,136,136"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a2a87ef47168dc639b307a285b8cb4462" title=" " alt="" coords="186,51,256,77"/>
<area shape="poly" title=" " alt="" coords="135,90,170,78,172,83,137,95"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a4a79780b9057489f0740020d6bae250f" title=" " alt="" coords="185,101,258,128"/>
<area shape="poly" title=" " alt="" coords="136,112,169,112,169,117,136,117"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a1f0795cbda29e32b3d6f379c226726f3" title=" " alt="" coords="184,152,259,179"/>
<area shape="poly" title=" " alt="" coords="137,134,170,145,168,150,135,139"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#ad7447ba17575882ac4c7c286d82c2b27" title="onDisconnect" alt="" coords="338,5,469,48"/>
<area shape="poly" title=" " alt="" coords="256,54,323,40,324,46,257,60"/>
<area shape="rect" href="../../d3/d47/classwheels_1_1debug.html#a5fa52d8a6d24d2f6686055e7cefa04b6" title=" " alt="" coords="307,72,500,99"/>
<area shape="poly" title=" " alt="" coords="257,65,292,70,291,75,257,71"/>
<area shape="rect" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html#a76cd2f25cc8ce95667c217e3e9fad0ff" title="从paho.mqtt构造对象" alt="" coords="338,133,469,176"/>
<area shape="poly" title=" " alt="" coords="259,160,323,157,323,162,260,166"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#ad8891a42152cd57b070ff9605d836013" title="处理接收到消息后的操作" alt="" coords="338,200,469,243"/>
<area shape="poly" title=" " alt="" coords="260,174,324,194,323,199,259,179"/>
</map>
</div>

</div>
</div>
<a id="ae7b92bc1964d9d3bf1d64fb2f10d23fc" name="ae7b92bc1964d9d3bf1d64fb2f10d23fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae7b92bc1964d9d3bf1d64fb2f10d23fc">&#9670;&#160;</a></span>~mqttClient()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">mqttClient::~mqttClient </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00368">368</a> 行定义.</p>
<div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="../../dc/d63/classwheels_1_1mqtt_client_ae7b92bc1964d9d3bf1d64fb2f10d23fc_cgraph.png" border="0" usemap="#adc/d63/classwheels_1_1mqtt_client_ae7b92bc1964d9d3bf1d64fb2f10d23fc_cgraph" alt=""/></div>
<map name="adc/d63/classwheels_1_1mqtt_client_ae7b92bc1964d9d3bf1d64fb2f10d23fc_cgraph" id="adc/d63/classwheels_1_1mqtt_client_ae7b92bc1964d9d3bf1d64fb2f10d23fc_cgraph">
<area shape="rect" title=" " alt="" coords="5,5,136,48"/>
<area shape="rect" href="../../d3/d47/classwheels_1_1debug.html#a5fa52d8a6d24d2f6686055e7cefa04b6" title=" " alt="" coords="184,13,377,40"/>
<area shape="poly" title=" " alt="" coords="136,24,168,24,168,29,136,29"/>
</map>
</div>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a4329b65aa8c1abb55bcb3db9681fdaa3" name="a4329b65aa8c1abb55bcb3db9681fdaa3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4329b65aa8c1abb55bcb3db9681fdaa3">&#9670;&#160;</a></span>connect() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">mqttClient::emErrCode</a> mqttClient::connect </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00236">236</a> 行定义.</p>

</div>
</div>
<a id="a22ff47cb8d97053a4cfe5ff42d18ef8a" name="a22ff47cb8d97053a4cfe5ff42d18ef8a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a22ff47cb8d97053a4cfe5ff42d18ef8a">&#9670;&#160;</a></span>connect() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">mqttClient::emErrCode</a> mqttClient::connect </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>cid</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>user</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>pswd</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00259">259</a> 行定义.</p>

</div>
</div>
<a id="af3facee7aa2c691086a033399213b1bf" name="af3facee7aa2c691086a033399213b1bf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af3facee7aa2c691086a033399213b1bf">&#9670;&#160;</a></span>errMsg()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string mqttClient::errMsg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">emErrCode</a></td>          <td class="paramname"><span class="paramname"><em>e</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00320">320</a> 行定义.</p>

</div>
</div>
<a id="a087c54091586ca6631b483624ae01cbe" name="a087c54091586ca6631b483624ae01cbe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a087c54091586ca6631b483624ae01cbe">&#9670;&#160;</a></span>isConnected()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mqttClient::isConnected </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>是否已经成功建立连接 </p>
<dl class="section return"><dt>返回</dt><dd>成功连接返回true, 否则返回false </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00489">489</a> 行定义.</p>

</div>
</div>
<a id="ad7447ba17575882ac4c7c286d82c2b27" name="ad7447ba17575882ac4c7c286d82c2b27"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad7447ba17575882ac4c7c286d82c2b27">&#9670;&#160;</a></span>onDisconnect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mqttClient::onDisconnect </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>cause</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>onDisconnect </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">cause</td><td></td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00379">379</a> 行定义.</p>
<div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="../../dc/d63/classwheels_1_1mqtt_client_ad7447ba17575882ac4c7c286d82c2b27_icgraph.png" border="0" usemap="#adc/d63/classwheels_1_1mqtt_client_ad7447ba17575882ac4c7c286d82c2b27_icgraph" alt=""/></div>
<map name="adc/d63/classwheels_1_1mqtt_client_ad7447ba17575882ac4c7c286d82c2b27_icgraph" id="adc/d63/classwheels_1_1mqtt_client_ad7447ba17575882ac4c7c286d82c2b27_icgraph">
<area shape="rect" title="onDisconnect" alt="" coords="302,39,432,81"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a2a87ef47168dc639b307a285b8cb4462" title=" " alt="" coords="184,47,254,73"/>
<area shape="poly" title=" " alt="" coords="286,63,255,63,255,57,286,57"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#aa5e61c99c5000159df5ae7a8bef121ff" title="构造MQTT客户端。在默认情况下如果不指定MQTT协议的版本，以3.1.1版本尝试连接；如果练级失败会尝试以3.1连接，再次失败会以5.0版本尝试" alt="" coords="5,5,136,48"/>
<area shape="poly" title=" " alt="" coords="168,51,135,44,137,39,169,46"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#a70147cdf4f553bb2129e368d16d6cc27" title=" " alt="" coords="5,72,136,115"/>
<area shape="poly" title=" " alt="" coords="169,74,137,81,135,76,168,69"/>
</map>
</div>

</div>
</div>
<a id="ad8891a42152cd57b070ff9605d836013" name="ad8891a42152cd57b070ff9605d836013"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad8891a42152cd57b070ff9605d836013">&#9670;&#160;</a></span>onRecv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int mqttClient::onRecv </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>tp</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a> &amp;</td>          <td class="paramname"><span class="paramname"><em>msg</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>处理接收到消息后的操作 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">tp[</td><td>I ]，主题名 </td></tr>
    <tr><td class="paramname">msg[</td><td>I ]，消息内容 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>消息处理正常返回1，否则返回0 </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00496">496</a> 行定义.</p>
<div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="../../dc/d63/classwheels_1_1mqtt_client_ad8891a42152cd57b070ff9605d836013_icgraph.png" border="0" usemap="#adc/d63/classwheels_1_1mqtt_client_ad8891a42152cd57b070ff9605d836013_icgraph" alt=""/></div>
<map name="adc/d63/classwheels_1_1mqtt_client_ad8891a42152cd57b070ff9605d836013_icgraph" id="adc/d63/classwheels_1_1mqtt_client_ad8891a42152cd57b070ff9605d836013_icgraph">
<area shape="rect" title="处理接收到消息后的操作" alt="" coords="307,39,437,81"/>
<area shape="rect" href="../../d8/d5b/mqtt_8cpp.html#a1f0795cbda29e32b3d6f379c226726f3" title=" " alt="" coords="184,47,259,73"/>
<area shape="poly" title=" " alt="" coords="292,63,260,63,260,57,292,57"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#aa5e61c99c5000159df5ae7a8bef121ff" title="构造MQTT客户端。在默认情况下如果不指定MQTT协议的版本，以3.1.1版本尝试连接；如果练级失败会尝试以3.1连接，再次失败会以5.0版本尝试" alt="" coords="5,5,136,48"/>
<area shape="poly" title=" " alt="" coords="168,51,136,44,137,39,169,46"/>
<area shape="rect" href="../../dc/d63/classwheels_1_1mqtt_client.html#a70147cdf4f553bb2129e368d16d6cc27" title=" " alt="" coords="5,72,136,115"/>
<area shape="poly" title=" " alt="" coords="169,74,137,81,136,76,168,69"/>
</map>
</div>

</div>
</div>
<a id="ac71f4aefef7cea607fc58569bfa23ce4" name="ac71f4aefef7cea607fc58569bfa23ce4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac71f4aefef7cea607fc58569bfa23ce4">&#9670;&#160;</a></span>pub() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">mqttClient::emErrCode</a> mqttClient::pub </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>topic</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *</td>          <td class="paramname"><span class="paramname"><em>data</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t</td>          <td class="paramname"><span class="paramname"><em>len</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>采用默认的消息体发布消息，在默认情况下Qos = 1, retain = true， dup=0 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">topic[</td><td>I ]， 要发布的消息主题 </td></tr>
    <tr><td class="paramname">data[</td><td>I ]， 消息内容 </td></tr>
    <tr><td class="paramname">len[</td><td>I ]，消息数据长度 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功操作返回OK，否则返回错误代码 </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00393">393</a> 行定义.</p>

</div>
</div>
<a id="a6be7209c55c982b1a61ea83e58153bf8" name="a6be7209c55c982b1a61ea83e58153bf8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6be7209c55c982b1a61ea83e58153bf8">&#9670;&#160;</a></span>pub() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">mqttClient::emErrCode</a> mqttClient::pub </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>topic</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a> &amp;</td>          <td class="paramname"><span class="paramname"><em>msg</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>按照自定义消息的方法发布消息，可以通过构造msg内容来实现 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">topic[</td><td>I ], 主题 </td></tr>
    <tr><td class="paramname">msg[</td><td>I ], 消息 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd></dd></dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00415">415</a> 行定义.</p>

</div>
</div>
<a id="a677c0a83def22ef765ebe23803423d38" name="a677c0a83def22ef765ebe23803423d38"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a677c0a83def22ef765ebe23803423d38">&#9670;&#160;</a></span>reconnect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mqttClient::reconnect </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>cid</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>pswd</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>重新连接 </p>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00286">286</a> 行定义.</p>
<div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="../../dc/d63/classwheels_1_1mqtt_client_a677c0a83def22ef765ebe23803423d38_cgraph.png" border="0" usemap="#adc/d63/classwheels_1_1mqtt_client_a677c0a83def22ef765ebe23803423d38_cgraph" alt=""/></div>
<map name="adc/d63/classwheels_1_1mqtt_client_a677c0a83def22ef765ebe23803423d38_cgraph" id="adc/d63/classwheels_1_1mqtt_client_a677c0a83def22ef765ebe23803423d38_cgraph">
<area shape="rect" title="重新连接" alt="" coords="5,5,136,48"/>
<area shape="rect" href="../../d3/d47/classwheels_1_1debug.html#a5fa52d8a6d24d2f6686055e7cefa04b6" title=" " alt="" coords="184,13,377,40"/>
<area shape="poly" title=" " alt="" coords="136,24,168,24,168,29,136,29"/>
</map>
</div>

</div>
</div>
<a id="a7bf7e3ef62cc9846865268cf499148ee" name="a7bf7e3ef62cc9846865268cf499148ee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7bf7e3ef62cc9846865268cf499148ee">&#9670;&#160;</a></span>setDisconnect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mqttClient::setDisconnect </td>
          <td>(</td>
          <td class="paramtype">std::function&lt; void() &gt;</td>          <td class="paramname"><span class="paramname"><em>fun</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00374">374</a> 行定义.</p>

</div>
</div>
<a id="a100bbcd47136dca546d1b36ba4086845" name="a100bbcd47136dca546d1b36ba4086845"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a100bbcd47136dca546d1b36ba4086845">&#9670;&#160;</a></span>sub()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">mqttClient::emErrCode</a> mqttClient::sub </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>topic</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>qos</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::function&lt; void(const std::string &amp;tp, const <a class="el" href="../../d0/d12/structwheels_1_1mqtt_client_1_1st_msg.html">stMsg</a> &amp;) &gt;</td>          <td class="paramname"><span class="paramname"><em>cb</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>订阅主题，并登记相关主题的回调函数 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">topic[</td><td>I ]，要订阅的主题 </td></tr>
    <tr><td class="paramname">cb[</td><td>I ]，回调函数 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>操作成功返回OK，否则返回错误代码 </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00437">437</a> 行定义.</p>

</div>
</div>
<a id="a75add329cda55d67c6e106e814617afd" name="a75add329cda55d67c6e106e814617afd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a75add329cda55d67c6e106e814617afd">&#9670;&#160;</a></span>unSub()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="#a9ef036b2ecddf62dde5597f6e9936616">mqttClient::emErrCode</a> mqttClient::unSub </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>topic</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a> 第 <a class="el" href="../../d8/d5b/mqtt_8cpp_source.html#l00473">473</a> 行定义.</p>

</div>
</div>
<a id="aa6e079b0c420f464d3b2ba100741f1bc" name="aa6e079b0c420f464d3b2ba100741f1bc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa6e079b0c420f464d3b2ba100741f1bc">&#9670;&#160;</a></span>version()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void wheels::mqttClient::version </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>v</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html">mqtt.hpp</a> 第 <a class="el" href="../../d5/d27/mqtt_8hpp_source.html#l00102">102</a> 行定义.</p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>include/<a class="el" href="../../d5/d27/mqtt_8hpp_source.html">mqtt.hpp</a></li>
<li>src/<a class="el" href="../../d8/d5b/mqtt_8cpp_source.html">mqtt.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
